using System;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;

namespace WebApiFrame.Controllers
{

    [Route("api/[controller]")]
    [ApiController]
    public class TestController:ControllerBase
    {  
        private  ILogger<TestController> _logger;
    public TestController(ILogger<TestController> logger)
    {
      _logger=logger;
    }
        [HttpGet]
        public ActionResult<string> Get()
        {
           _logger.LogInformation("This is Information Log!");
           _logger.LogWarning("This is Warning Log!");
           _logger.LogError("This is Error Log!");
            return "result";
        }
         [HttpGet("{id}")]
         public IActionResult methodName(int id)
        {
        throw new Exception("GetAll function failed!");
        }
    }
}